package com.example.czxyschool.web;

import com.example.czxyschool.mapper.TopicMapper;
import com.yc.czxy.bean.Topic;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("topic")
public class TopicAction {

    @Resource
    TopicMapper topicMapper;

    @RequestMapping ("local")
    @ResponseBody//(required = false)--》参数可以为空
    public List<Topic> Topic(@RequestParam Map<String,Object>map){
        List<Topic> topics = topicMapper.selectByLocation((String) map.get("location"));
        return topics;
    }
    @GetMapping("all")
    @ResponseBody
    public List<Topic> selectTopic(){
        List<Topic> topics = topicMapper.select();
        return topics;
    }
}
